package org.javaopenaccess.service.user;


import org.javaopenaccess.command.UserCommand;
import org.javaopenaccess.dao.user.UserDao;
import org.javaopenaccess.model.User;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class UserServiceImpl implements UserService {
	private Logger logger = LoggerFactory.getLogger(this.getClass().getName());
	
	private UserDao userDao;

	public void setUserDao(UserDao userDao) {
		this.userDao = userDao;
	}
	
	@Override
	public User getUser(UserCommand form) throws UserNotFoundException {
		return userDao.getUser(new User(form));
	}
	
	@Override
	public User getUser(String userName) throws UserNotFoundException {
		return userDao.getUser(userName);
	}

	@Override
	public void createUser(User user) {
		userDao.storeUser(user);
	}
}
